<?php
/**
 * classe que represento o usuario do site
 * @access public
 * @author Magno Leal
 * @package model
 */
class UsuarioBean {
    /**
     * /@AttributeType long
     */
    private $usuarioID;
    /**
     * @MinLengthValidator(min = 5)     
     */
    private $login;
    /**
     * @MinLengthValidator(min = 5)
     */
    private $senha;
    /**
     * @EmailValidator
     */
    private $email;
    /**
     * /@AttributeType String     
     */
    private $ip;
    /**
     * /@AttributeType Timestamp
     */
    private $dataCriacao;    
    /**
     * /@AttributeType Media
     */
    private $media;
    /**
     * /@AttributeType Status
     */
    private $status;

    function __construct($usuarioID = 0, $login = "", $senha = "", $email = "", $ip = "", $dataCriacao = "", $media = null, $status = null) {
        $this->usuarioID = $usuarioID;
        $this->login = $login;
        $this->senha = $senha;
        $this->email = $email;
        $this->ip = $ip;
        $this->dataCriacao = $dataCriacao;
        $this->media = $media;
        $this->status = $status;
    }

    public function getUsuarioID() {
        return $this->usuarioID;
    }

    public function setUsuarioID($usuarioID) {
        $this->usuarioID = $usuarioID;
    }

    public function getLogin() {
        return $this->login;
    }

    public function setLogin($login) {
        $this->login = $login;
    }

    public function getSenha() {
        return $this->senha;
    }

    public function setSenha($senha) {
        $this->senha = $senha;
    }

    public function getEmail() {
        return $this->email;
    }

    public function setEmail($email) {
        $this->email = $email;
    }

    public function getIp() {
        return $this->ip;
    }

    public function setIp($ip) {
        $this->ip = $ip;
    }

    public function getDataCriacao() {
        return $this->dataCriacao;
    }

    public function setDataCriacao($dataCriacao) {
        $this->dataCriacao = $dataCriacao;
    }

    public function getMedia() {
        return $this->media;
    }

    public function setMedia($media) {
        $this->media = $media;
    }

    public function getStatus() {
        return $this->status;
    }

    public function setStatus($status) {
        $this->status = $status;
    }
    
    public function toJson() {
        return json_encode($this->toBD());
    }

    public function toBD() {
        $usuario = array();

        $usuario['usuarioID'] = $this->usuarioID;
        $usuario['login'] = $this->login;
        $usuario['senha'] = $this->senha;
        $usuario['email'] = $this->email;
        $usuario['mediaID'] = $this->media->getMediaID();
        $usuario['statusID'] = $this->status->getStatusID();

        return $usuario;

    }
}
?>